@extends('admin.public.admin')
@section('main')
<div class="mws-panel grid_8">
	<div class="mws-panel-header">
    	<span>分类添加</span>
    </div>

    <div class="mws-panel-body no-padding">
    	<form class="mws-form" action="/admin/types" method="post">
    		{{ csrf_field() }}
    		<div class="mws-form-inline">

                 <div class="mws-form-row">
                    <label class="mws-form-label">父类名称</label>
                    <div class="mws-form-item">
                        <?php
                            $id=isset($_GET['id'])?$_GET['id']:'';
                        ?>

                        @if($id)
                        <select class="small" name="pid" disabled>
                            <option value="0">--父级菜单--</option>
                            @foreach($data as $k=>$v)

                                @if(substr_count($v['path'],',')<=2)
                                
                                    <option value="{{$v['id']}}" {{$v['id']==$id ? 'selected' : ''}}>{{$v['typename']}}</option>
                                    
                                @endif
                            @endforeach
                        </select>
                        @else

                        <select class="small" name="pid">
                            <option value="0">--父级菜单--</option>
                            @foreach($data as $k=>$v)

                                @if(substr_count($v['path'],',')<=2)
                                
                                    <option value="{{$v['id']}}" {{$v['id']==$id ? 'selected' : ''}}>{{$v['typename']}}</option>
                                    
                                @endif
                            @endforeach
                        </select>

                        @endif

                    </div>
                </div>
                
    			<div class="mws-form-row">
    				<label class="mws-form-label">分类名称</label>
    				<div class="mws-form-item">
    					<input type="text" class="small" name="typename">
    				</div>
    			</div>

                <div class="mws-form-row">
                    <label class="mws-form-label">分类标题</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="title">
                    </div>
                </div>


                <div class="mws-form-row">
                    <label class="mws-form-label">关键字</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="keywords">
                    </div>
                </div>
                
                <div class="mws-form-row">
                    <label class="mws-form-label">分类描述</label>
                    <div class="mws-form-item">
                        <textarea name="description" rows="10" cols="40" class="small">
                            
                        </textarea>
                    </div>
                </div>
    		      

                   <div class="mws-form-row">
                        <label class="mws-form-label">是否楼层</label>
                        <div class="mws-form-item clearfix">
                             <ul class="mws-form-list inline">
                                  <li><input type="radio" name="is_lou" value="0"  checked> <label>否</label></li>
                                  <li><input type="radio" name="is_lou" value="1"> <label>是</label></li>                                       
                             </ul>
                        </div>
                   </div>
    			
    			
    		</div>
    		<div class="mws-button-row">
    			<input type="submit" value="添加" class="btn btn-danger">
    			<input type="reset" value="重置" class="btn ">
    		</div>
    	</form>
    </div>    	
</div>
@endsection